package com.example.demo.mapper;

import com.example.demo.entity.RoleDepartmentUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;

@Mapper
public interface RoleDepartmentUserMapper {

    /**
     * 查询所有角色部门用户关联
     */
    List<RoleDepartmentUser> selectAll();

    /**
     * 根据ID查询角色部门用户关联
     */
    RoleDepartmentUser selectById(Integer id);

    /**
     * 插入角色部门用户关联
     */
    int insert(RoleDepartmentUser roleDepartmentUser);

    /**
     * 更新角色部门用户关联
     */
    int updateById(RoleDepartmentUser roleDepartmentUser);

    /**
     * 删除角色部门用户关联
     */
    int deleteById(Integer id);

    /**
     * 统计角色部门用户关联数量
     */
    long count();

    /**
     * 根据角色配置ID和部门ID查询用户关联
     */
    List<RoleDepartmentUser> selectByRoleAndDepartment(Integer roleConfigId, Integer departmentId);
    
    /**
     * 根据角色名称模糊搜索
     */
    List<RoleDepartmentUser> selectByRoleNameLike(@Param("roleName") String roleName);
    
    /**
     * 根据部门名称模糊搜索
     */
    List<RoleDepartmentUser> selectByDepartmentNameLike(@Param("departmentName") String departmentName);
    
    /**
     * 根据用户名称模糊搜索
     */
    List<RoleDepartmentUser> selectByUserNameLike(@Param("userName") String userName);
}